package org.example.j2024_11_9;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RequestMapping("/body")
@Controller
public class BodyController {

   @ResponseBody
    @RequestMapping("/b1")
    public String b1(){
       return "<h1>这是html片段</h1>" ;
   }

   @ResponseBody
    @RequestMapping("/b2")
    public UserInfo b2(){
       UserInfo u1 = new UserInfo();
       u1.setId(1);
       u1.setName("zhangsan");
       return u1 ;
   }

   @ResponseBody
    @RequestMapping("/b3")
    public int[] r3(){
       return new int[]{1,2,3} ;
   }

    @ResponseBody
    @RequestMapping("/b4")
    public Map<String , Integer> r4(){
        Map<String,Integer> map = new HashMap<>();
        map.put("zhangsan" , 1) ;
       return  map;
    }

    @RequestMapping("/b5")
    public String b5(){
       return "/a.js";
    }

    @RequestMapping("/b6")
    public String b6(){
        return "/b.css";
    }



}
